package com.xwaf.platform.system.provider.task;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import com.alibaba.fastjson.JSON;
import com.xwaf.platform.system.api.entity.mqtt.IMSuccessMessage;
import com.xwaf.platform.system.api.entity.mqtt.IMUser;
import com.xwaf.platform.system.api.service.mqtt.MqttMessageService;

@Component
public class MqttTask {

	@Autowired
	MqttMessageService mqttMessageService;

	// @Scheduled(cron = "1 * * * * ?")
	public void mqttTask() {
		IMUser imUser = new IMUser();
		imUser.setAvatarUrl("www.baidu.com");
		imUser.setNickname("TestMqtt");
		imUser.setUid(11L);
		IMSuccessMessage message = IMSuccessMessage.newBulider(imUser, "測試成功");
		System.out.println(JSON.toJSONString(message));
		mqttMessageService.sendTestMessage("12580", message);
	}
}
